package com.zdsoft.finance.evaluate.repository;

import com.zdsoft.finance.common.base.CustomRepository;
import com.zdsoft.finance.evaluate.entity.ProjectEvaluate;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/** 项目评审操作库
 * @author LiaoGuoWei
 * @create 2016-10-19 14:09
 **/
public interface ProjectEvaluateRepository extends CustomRepository<ProjectEvaluate,String> {

    /**
     * 通过项目编号和是否有效查询
     * @param projectCd 项目编号
     * @param isDeleted 是否有效
     * @return
     */
    public ProjectEvaluate findByProjectCodeAndIsDeleted(String projectCd, boolean isDeleted);

    /**
     * 逻辑删除
     * @param id 需要删除的ID
     * @return
     */
    @Modifying(clearAutomatically = true)
    @Query("update ProjectEvaluate u set u.isDeleted = true where u.id = :id ")
    public int deleteProjectEvaluate(@Param("id") String id);

//    /**
//     * 根据busiFormNo查找
//     * @param busiFormNo 业务编号
//     * @return
//     */
//    @Query(" select p from ProjectEvaluate p  where p.isDeleted=false and p.busiForm.busiFormNo = :busiFormNo ")
//    public ProjectEvaluate findWithBusiFormNo(@Param("busiFormNo")String busiFormNo);
}
